<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
 <script type="text/javascript">
$(function(){
	//初始化表单验证
	$("#addForm").validate({
		rules:{			
			tel: {isTelOrMobile: true},
			aphone: {isTelOrMobile: true},
			dixian: {isFloatGteZeroLtOne:true}
		},
		messages:{				
			title: {required: "请输入分公司名称"},
			shortName:{required: "请输入分公司简称"},	
			BranchId:{required: "请输入关联分公司的Id"},
			address:{required: "请输入分公司具体地址"}, 
			//tel: {required: "请输入座机或手机号码"},
			aname:{required: "请输入联系人姓名"}, 
			aphone:{required: "请输入座机或手机号码"}, 
		},
		submitHandler:function(form){
			$(form).ajaxSubmit({
				success:function(data){
					switch(data.flag){
						case 2:
							Kit.alert("分公司名称不能大于30个字");return;
						case 3:
							Kit.alert("分公司名已经存在");return;
						case 5:
							Kit.alert("分公司简称不能大于10个字");return;
						case 8:
							Kit.alert("地址不能大于100个字");return;
						case 9:
							Kit.alert("请输入座机或手机号码");return;
						case 10:
							Kit.alert("请输入手机号码");return;
						case 11:
							Kit.alert("请输入手机号码");return;
						/* case 14:
							Kit.alert("请输入关联分公司的Id");return; */
						case -1:
							Kit.alert("网络繁忙...，请重试");return;
						case 0:
							onEditSuccess(data.object);
							editDialog.close();
							return;
					}
				}
			});
		}
	});
});
var Picture;
function ToPicture(){
	Picture = Kit.dialog("编辑图片","${BASE_PATH}/dict/store/imageIndex/${object.stroeimagenum}",{closable:true,size:"size-wide"}).open();
}

</script> 
<form id="addForm" action="${BASE_PATH}/dict/store/doEdit" method="post" class="form-horizontal" enctype="multipart/form-data">
	<div class="form-group">
	    <label class="col-sm-2 control-label">分公司名称</label>
	    <div class="col-sm-10">
        	<input type="text" name="title" value="${object.title}" class="form-control" placeholder="分公司名称" required maxlength="20">
	    </div>
	</div>
	<div class="form-group">
	    <label class="col-sm-2 control-label">分公司简称</label>
	    <div class="col-sm-10">
        	<input type="text" id="titleld" name="shortName" value="${object.shortName}" class="form-control" placeholder="请输入分公司简称" required maxlength="50">
	    </div>
	</div>
	<div style="display: none;">
		<div class="form-group">
		    <label class="col-sm-2 control-label">同步Id</label>
		    <div class="col-sm-10">
	        	<input type="text" id="BranchId" name="BranchId" value="${object.BranchId}" class="form-control" placeholder="请输入与第三方同步的Id" maxlength="30">
		    </div>
		</div>
		<div class="form-group">
		    <label class="col-sm-2 control-label">抵现比例</label>
		    <div class="col-sm-10">
	        	<input type="text" id="dixian" name="dixian"  class="form-control" value="${object.predixian}"   maxlength="30">
		    </div>
		</div>
		<div class="form-group">
		    <label class="col-sm-2 control-label">抵现积分类型</label>
		    <div class="col-sm-10">
				<select id="selectpoint" name="selectpoint" class="selectpicker form-control" data-width="210">
				
					<option value="1" <c:if test="${object.prepoint ==1 }">selected</c:if>>积分</option>
					<option value="2" <c:if test="${object.prepoint ==2 }">selected</c:if>>抵扣券</option>
					<option value="3" <c:if test="${object.prepoint ==3 }">selected</c:if>>惠券</option>
				</select>
			</div>			
		</div>
	</div>
	 <div class="form-group">
	    <label class="col-sm-2 control-label">所在城市</label>
	    <div class="col-sm-10">
					<select id="state" class="selectpicker form-control " name="city"   data-width="210">
							<option value="${object.city}" name="city">${object.name}</option>	
						 <c:forEach items="${list}" var="city">					
							<option value="${city.id }" name="city">${city.name}</option>							
						</c:forEach>					
					</select>
					</div>	
					<%-- <c:when test="${lis.city.name!=null}"></c:when><c:otherwise>${city.name}</c:otherwise>	 --%>	
	</div>	  
	<div class="form-group">
		<label class="col-sm-2 control-label">主营范围</label>
		<div class="col-sm-10">
			 <ul class="iCheckList">
				<li><input type="radio" class="iCheck" name="scope" value="1" <c:if test="${object.scope ==1 }">checked</c:if>>&nbsp;常规</li>
				<li><input type="radio" class="iCheck" name="scope" value="2" <c:if test="${object.scope ==2 }">checked</c:if>>&nbsp;团购</li>
				<li><input type="radio" class="iCheck" name="scope" value="3" <c:if test="${object.scope ==3 }">checked</c:if>>&nbsp;全部周期</li>
			</ul>
		</div>
	</div>
	<div class="form-group">
	    <label class="col-sm-2 control-label">地理位置</label>
	    <div class="col-sm-10">
        	<input type="text" id="" name="address" value="${object.address}" class="form-control" placeholder="请输入地理位置" required maxlength="50">
	    </div>
	</div>
	<div class="form-group">
	    <label class="col-sm-2 control-label">店内联系方式</label>
	    <div class="col-sm-10">
        	<input type="text" name="tel" value="${object.tel}" class="form-control"placeholder="请输入店内联系方式如：0371-1738675" required maxlength="20" readonly>
	    </div>
	</div>
	<%-- <div class="form-group">
		<label class="col-sm-2 control-label">地图定位</label>
		<div class="col-sm-10">
			<input type="file" id="thumb" name="storethumb" accept="image/jpg" title="选择文件" <c:if test="${object.storethumb!=null}">data-val="${object.storethumb}"</c:if>>
		</div>
		<div class="col-lg-offset-2 p-t-5 col-lg-9"><span class="text-success">建议640px*300px,大小60K以内，支持JPEG、PNG格式</span></div>
	</div> --%>
	<div class="form-group">
		<label class="col-sm-2 control-label">分公司营业执照</label>
		<div class="col-sm-10" style="width: 50%;float: left">
			<input type="file" id="thumb" name="busthumb" accept="image/jpg,image/png"  title="选择文件" <c:if test="${object.busthumb!=null}">data-val="${object.busthumb}"</c:if>>
		</div>
		<div class="col-lg-offset-2 p-t-5 col-lg-9"><span class="text-success">建议640px*300px,大小60K以内，支持JPEG、PNG格式</span></div>
	</div>
	<div class="form-group">
		<label class="col-sm-2 control-label">图片管理</label>
		<div class="col-sm-10">
	  	 <a class="btn btn-primary" onclick="ToPicture();">轮播图片</a>
		</div>
	</div>
	<div class="form-group">
	    <label class="col-sm-2 control-label">联系人姓名</label>
	    <div class="col-sm-10">
        	<input type="text" name="aname" value="${object.aname}" class="form-control" placeholder="请输入联系人名称" required maxlength="20">
	    </div>
	</div>
	<div class="form-group">
	    <label class="col-sm-2 control-label">联系方式</label>
	    <div class="col-sm-10">
        	<input type="text" name="aphone" value="${object.aphone}" class="form-control" placeholder="请输入电话" maxlength="13">
	    </div>
	</div>
	<!-- -------------------------------------- -->
	<div style="display: none;">
	    <p style=" margin-left: 100px "> 请提供一个本店其他人员的联系方式</p>
	  
		<div class="form-group">
		    <label class="col-sm-2 control-label">姓名</label>
		    <div class="col-sm-10">
	        	<input type="text" name="bname" value="${object.bname}" class="form-control" placeholder="请输入联系人姓名" required maxlength="20">
		    </div>
		</div>
		<div class="form-group">
		    <label class="col-sm-2 control-label">联系方式</label>
		    <div class="col-sm-10">
	        	<input type="text" name="bphone" value="${object.bphone}" class="form-control" placeholder="请输入电话" maxlength="13">
		    </div>
		</div>
	</div>
	<!-- -------------------------------------- -->
	<div class="row">
		<div class="col-lg-6"><button class="btn btn-primary col-sm-3 pull-right" type="submit" autocomplete="off">提交</button></div>
		<div class="col-lg-6"><button class="btn btn-default col-sm-3 pull-left" type="button" onclick="javascript:editDialog.close();" autocomplete="off">取消</button></div>
	</div>
	<input type="hidden" name="thumbOld" value="${object.storethumb}"/>
	<input type="hidden" name="thumbOldd" value="${object.busthumb}"/>
	<input type="hidden" name="id" value="${object.id}"/>
	<input type="hidden" name="stroeimagenum" value="${object.stroeimagenum}"/>
</form>